package com.liuzh.deviceinfo;

import android.app.Application;
import android.content.IntentFilter;
import android.content.pm.PackageManager;
import android.content.res.Configuration;
import android.graphics.drawable.Drawable;
import b.i.c.a;
import c.h.a.f0.j;
import c.h.a.l0.b;
import c.h.a.m0.i;
import c.h.a.n;
import c.h.a.o;
import c.h.a.p;
import c.h.b.a.a.e;
import c.h.b.a.b.c;
import com.bytedance.sdk.openadsdk.TTAdConfig.Builder;
import com.bytedance.sdk.openadsdk.TTAdSdk;
import com.huawei.hms.api.HuaweiMobileServicesUtil;
import com.liuzh.deviceinfo.widget.CommonWidget;
import java.util.Collections;
import java.util.Objects;
import java.util.Timer;

public class DeviceInfoApp extends Application {
    public static DeviceInfoApp c;
    public static int d;
    public PackageManager a;
    public boolean b = true;

    public DeviceInfoApp() {
        c = this;
    }

    public static Drawable a(int i) {
        DeviceInfoApp deviceInfoApp = c;
        Object obj = a.a;
        return deviceInfoApp.getDrawable(i);
    }

    public static String d(int i) {
        return c.getString(i);
    }

    public PackageManager b() {
        if (this.a == null) {
            this.a = getPackageManager();
        }
        return this.a;
    }

    public void c() {
        if (this.b) {
            this.b = false;
            c.a = false;
            try {
                TTAdSdk.init(this, new Builder().appId(getString(2131690145)).useTextureView(false).appName(getString(2131689568)).titleBarTheme(1).allowShowNotify(true).allowShowPageWhenScreenLock(false).debug(c.a).directDownloadNetworkType(4, 3, 2, 5, 1).supportMultiProcess(false).build());
                c.b = true;
            } catch (Exception unused) {
            }
            e eVar = e.b;
            eVar.a.add(c.h.b.a.b.a.a);
            c.h.a.v.a.b.setEnabled(true);
            c.h.a.v.a.b.b("Channel", "Huawei");
            c.h.a.v.a.b.c("devinfo_start", null);
            j jVar = j.d;
            Objects.requireNonNull(jVar);
            jVar.a.d(this, 1, Collections.singletonList("devinfo_vip"), new o(this));
            jVar.a.c(this, 1, new p(this));
        }
    }

    public void onConfigurationChanged(Configuration configuration) {
        super.onConfigurationChanged(configuration);
        int i = d;
        int i2 = configuration.orientation;
        if (i != i2) {
            d = i2;
            c.h.a.u.a.a();
        }
    }

    public void onCreate() {
        super.onCreate();
        d = getResources().getConfiguration().orientation;
        HuaweiMobileServicesUtil.setApplication(this);
        b.b.a = new c.h.a.a0.b();
        j.d.a = new c.h.b.c.a.j();
        c.h.a.v.a.a.add(new c.h.a.a0.a(this));
        new Timer().schedule(new n(this), 0, 5000);
        registerReceiver(CommonWidget.c, new IntentFilter("android.intent.action.BATTERY_CHANGED"));
        c.h.a.v.a.b.setEnabled(false);
        i iVar = i.a;
        iVar = i.a;
        if (i.b.getBoolean("agree_privacy_policy", false)) {
            c();
        }
    }
}
